package com.travel.controller;

import com.qianfeng.util.ResultMsg;
import com.travel.entity.TbStrstegy;
import com.travel.service.StrstegyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/adminStrstegy")
public class AdminStrstegyController {
    @Autowired
    StrstegyService strstegyService;

    //分页查询所有的攻略
    @GetMapping("/strstegyGetdAll")
    public ResultMsg strstegyGetdAll(@RequestParam int current, @RequestParam int size){
        return strstegyService.strstegyGetAll(current,size);
    }
    //上传一个攻略
    @GetMapping("/strstegyAddOne")
    public ResultMsg strstegyAddOne(TbStrstegy tbStrstegy){
        return strstegyService.strstegyAddOne(tbStrstegy);
    }
    //修改一个攻略
    @PostMapping("/strstegyUpdateOne")
    public ResultMsg strstegyUpdateOne(@RequestBody TbStrstegy tbStrstegy){
        return strstegyService.strstegyUpdateOne(tbStrstegy);
    }
    //删除一个攻略
    @GetMapping("/strstegyDeleteOne/{sid}")
    public ResultMsg strstegyDeleteOne(@PathVariable("sid")Integer strstegyId){
        return strstegyService.strstegyDeleteOne(strstegyId);
    }
//查询一个
    @GetMapping("/strstegyFindOne/{sid}")
    public ResultMsg findOne(@PathVariable("sid") int sid){
        return strstegyService.findOne(sid);
    }
}
